import 'package:flutter/material.dart';

class NetworkDetectHelper {
  NetworkDetectHelper._();

  static bool contains(Object? source, List<dynamic> elements) {
    if (isEmpty(source)) return false;
    if (source is Map) {
      for (var value in elements) {
        if (source.containsKey(value)) {
          return true;
        }
      }
    } else if (source is Iterable) {
      for (var value in elements) {
        if (source.contains(value)) {
          return true;
        }
      }
    } else if (source is String) {
      for (var value in elements) {
        if (source.contains(value)) {
          return true;
        }
      }
    }
    return false;
  }

  static bool isEmpty(Object? source) {
    return source==null? true : false;
  }
}